﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Client_Web.ServiceReference;

namespace Client_Web.Account
{
    public partial class UserAccount : System.Web.UI.Page
    {
        protected UserStruct user;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (null != Session["userIdStr"])
            {
                ServiceClient serviceClient = new ServiceClient();
                string[] data = Util.CleanAndSplit(serviceClient.getUserInfo((string)Session["userIdStr"]));
                user = new UserStruct();
                user.id = data[0];
                user.name = data[1];
                user.login = data[2];
            }
        }

        protected void DeleteAccount_Click(object sender, EventArgs e)
        {
            if (null != Session["userIdStr"])
            {
                ServiceClient serviceClient = new ServiceClient();
                serviceClient.deleteUser((string)Session["userIdStr"]);
                Response.Redirect("~/CustomLogout.aspx");
            }
        }
    }
}